const api='api/book_data.json'
$(function(){
    $.getJSON(api,renderBookTable);

});
function renderBookTable(data){
    const tableBody=$('#booksTableBody');
    $.each(data,function(index,book){
        const row = $('<tr></tr>');
        // 创建单元格元素并添加到行中
        row.append('<td><a href="' + book.url + '" target="_blank">' + book.title + '</a></td>');
        row.append('<td>' + book.author + '</td>');
        row.append('<td>' + book.price + '</td>');
        row.append('<td>' + book.publisher + '</td>');
        // 将行添加到表格主体中
        tableBody.append(row);
    });

}